const KoaRouter = require('@koa/router')
const { create, getAvatar } = require('../controller/user.controller')
const { verifyUser, handlePassword } = require('../middleware/user.middleware')

// 1.定义路由对象
const userRouter = new KoaRouter({ prefix: "/users" })

// 2.具体路由规则
// 2.1用户注册
userRouter.post('/register', verifyUser, handlePassword, create)
// 获取用户头像接口
userRouter.get('/avatar/:userId', getAvatar)

module.exports = userRouter